<!DOCTYPE HTML>
<!-- <no_layout name="Layout\layout" />  -->
<!-- 文档在线查看功能需调用office web 365提供的接口，具体见https://www.officeweb365.com/ -->
<!-- 调用API时参数i的值可以为10124 -->
	<!-- main content start-->							
	<h3 class="title1">作业上交</h3>
				
	<div class="forms">
		<div class="form-grids row widget-shadow" data-example-id="basic-forms">

		
			<div class="form-title">
				<h4>提交作业 :</h4>
			</div>
			<div class="form-body">
				<div class="alert alert-info" style="width: 83.33333333%;    ">
				<ul style="list-style-type: none;">
				  <li><font color="blue">未按时提交作业的同学视为放弃互评分，无法参加互评</font> 
				  <li><font color="blue">未按时完成批改任务的同学，也无法得到互评分</font>
				  <li><font color="red">互评结束时间一般定为开始布置批改任务的一周之后</font>   
				  <li>严禁相互抄袭，否则倒扣分数
				  <li>每次实验报告每题一分，正确1分错误0分，编程题请在C环境中运行，得到正确结果才算正确
				  <li>每位同学在得到通知后，在待批改互评作业里下载其他同学的实验进行批改
				  <li>批改完毕后，在评阅里进行打分，并将批改后的报告提交到平台。
				  <li>假如待批改显示同学未提交，则请稍后再批改，通知助教
				  <li>批改后报告提交格式例：批改者名_原文件名.docx：李四_111150013_网络1102_张三_实验一_顺序结构与输入.docx
				  <li>上传文件大小不得超过500kb
              
				</ul>
				</div>
				<form action="__URL__/upload?savePath=/Homework/"  method="post" enctype="multipart/form-data">  <!-- 要使用上传功能 你的表单需要设置 enctype="multipart/form-data" -->
				<div class="form-group"> 
					<label for="exampleInputEmail1"></label> 
					<div class="form-group" >
						<label for="recipient-name" class="control-label"></label>
						<div class="col-md-10" style="padding-left: 0px;">
						<select name="homeworkNum" id="homeworkNum" class="form-control1">																
							<option selected="true" value="">请选择任务...</option>
							<volist name="list_menu" id="vo" key="k" >
								<option value="{$vo.id}">{$vo.ex_name}</option>																
							</volist>																
						</select>
						</div>
					</div>
				</div>							
				<div class="form-group" >
					<label for="message-text" class="control-label"></label>
					<div class=" compose-right col-md-12" style="width:100%;margin-left:0;">																																					
						<div class="btn btn-default btn-file">
							<i class="fa fa-paperclip"></i> 选择文件
							<input type="file" name="homeworkFile" onchange="$('#filenotice').html($('[name=homeworkFile]').val());	"/>
							<div class="showFileName"></div>
							<div class="fileerrorTip"></div>
						</div>
						<p class="help-block" id="filenotice">Max. 3MB(正则）</p>																														
					</div>					
				</div>								
				<div>
					<p class="help-block">Example block-level help text here.</p>
				</div>
				<div class="checkbox"> 
					<label> <input type="checkbox"> Check me out </label> 
				</div> 
				<button type="submit" class="btn btn-default">Submit</button> 					
				<!-- <input name="teamname" id="teamname" value="{$teamname}" type="hidden"  /> -->
				<input name="openid" id="openid" value="{$openid}" type="hidden"  />
				</form> 
			</div>
		</div>										
	</div>
	<div class="forms">
		<div class="form-grids row widget-shadow" data-example-id="basic-forms"> 
			<div class="form-title">
				<h4>作业一览 :</h4>
			</div>
			<div class="form-body">				
				<table class="table table-hover"> 
					<thead> 
						<tr> 
						<th>#</th> <th>作业名称	</th> <th>上传时间</th> <th>是否补交</th> <th>得分</th> <th>操作</th> </tr> 
					</thead> 
					<tbody>
					<volist name="homework" id="vo2" key="k" >					
						<tr> 
							<th scope="row">{$k}</th> 
							<td>{$vo2.ex_name}</td> <td>{$vo2.delivertime}</td> <td>{$vo2.flag}</td> <td>{$vo2.score}</td>
							<td>
								<a href="__UPLOAD__{$vo2.filesavename}">下载/</a>
								<a href="#">申诉/</a>
								<a href="http://ow365.cn/?i=10124&fname={vo2.filename}&furl=__UPLOAD__{$vo2.filesavename}" target="_blank">查看</a>
							</td>
						</tr> 
						<tr> 
					</volist>
					</tbody> 
				</table>
			</div>
		</div>
	</div>


					
		<script>
			//console.log('对象：',obj1);						
			function radio(checkbox) {
                $('input[type=checkbox]').prop('checked', false);
				$(checkbox).prop('checked',true);
				answer = $(checkbox).attr("id");
            }
			function changeMark()
			{																								
				$('#mark').attr("disabled","disabled");																	
				$('#mark').css('color','#777');	
							
			}
						
			if('{$isfromcollect}' == "1"){
				$('#next').val("Back");
				$("#next").attr("onclick","event.preventDefault();location.href='{$backurl}?itemid={$item.id}';");
				
			}
			$("#submit").click(function(event){
				event.preventDefault();
				if(answer=='no'){
					alert('Please select one option!');
					return false;
				}
					
				var ajaxData ={};
				ajaxData['itemid'] = $('#itemid').val();
				ajaxData['openid'] = $('#openid').val();				
				ajaxData['starttime'] = $('#starttime').val();				
				ajaxData['answer'] = answer;				
				ajaxData['__hash__'] = $('[name=__hash__]').attr('content');		
				//ajaxData['__hash__'] = document.getElementsByName("__hash__")[0].content;		
				$.ajax({
                    cache:false,
                    type:"POST",
					//async:false,
					//contentType:
                    url:"{:U('Random/getRightans')}",
                    dataType:"json",
                    data: ajaxData,
                    timeout:30000,
                    error:function(XMLHttpRequest, textStatus,errorThrown){                      
						return false;
                    },
                    success:function(jsApiParameters){
						if(jsApiParameters=='非法的请求方式' || typeof(jsApiParameters) == "undefined") {alert("网络问题，请稍后答题！");return false;}										
						var rightans     = "#opt"+jsApiParameters['rightans'];
						var que_analysis = jsApiParameters['que_analysis'];
						$("#myLoading").hide();
						$('#analysis').show();
						if($(rightans).prop('checked')){
							var tmp = "<h3 style=\"color:red\" id=\"right_lab\" value=\"1\">正确</h3>";
						}else var tmp = "<h3 style=\"color:red\" id=\"right_lab\" value=\"0\">错误</h3>";
						$('#analysis1').html(tmp+"<p>参考答案："+jsApiParameters['rightans']+"</p>");
						$('#analysis2').html("<p>解析：</p>"+"<h3>"+que_analysis);
						$('#next').show();
						if({$iscollect}) {					
							$('#mark').val("Marked");
							changeMark();
						} 						
						$('#mark').show();																		
						$('#submit').css('display','none');																		
                    }
                });
				
			});
			$("#mark").click(function(event){
				event.preventDefault();		
				var ajaxData ={};
				ajaxData['itemid'] = $('#itemid').val();
				ajaxData['openid'] = $('#openid').val();											
				ajaxData['right_lab'] = $('#right_lab').html();				
				ajaxData['__hash__'] = $('[name=__hash__]').attr('content');		
				//ajaxData['__hash__'] = document.getElementsByName("__hash__")[0].content;		
				$.ajax({
                    cache:false,
                    type:"POST",
                    url:"{:U('Random/setCollect')}",
                    dataType:"json",
                    data: ajaxData,
                    timeout:30000,                  
                    success:function(jsApiParameters){
						if(jsApiParameters=='非法的请求方式' || typeof(jsApiParameters) == "undefined") {alert("网络问题，请稍后答题！");return false;}										
						var markcount = jsApiParameters;
						
						$('#mark').val("Marked"+"("+markcount+")");	
						changeMark();							
                    }
                });												
			});	
			
		</script>
	<!-- main content end-->
	